import request from '../request';

export interface ChartSeries {
    name: string;
    data: number[];
}


export interface chartData {
    categories: string;
    series: ChartSeries[];
}

export interface chartRaderData {
    indicators:[],
    series:[]
}

export interface tableData {
    date: string,
    name: string,
    address: string
}

/**
 * 获取销售趋势数据
 */
export const getSalesTrend = (): Promise<{ data: chartData }> => {
    return request.get('/api/chart/salesTrend');
};

/**
 * 获取用户增长数据
 */
export const getUserGrowth = (): Promise<{data: chartData}> => {
    return request.get('/api/chart/userGrowsData');
}

/**
 * 获取访问来源信息
 */
export const gettrafficSource = (): Promise<{data: chartData}> => {
    return request.get('/api/chart/trafficSourceData');
}

/**
 * 获取区域销售信息
 */
export const getRegionSales = (): Promise<{data: chartData}> => {
    return request.get('/api/chart/regionSalesData');
}


/**
 * 获取table数据
 */
export const getAllTableData = (): Promise<{data: tableData[]}> => {
    return request.get('/api/table/all-data');
}

/**
 * 获取雷达图数据
 */
export const getPerformance = (): Promise<{data: chartRaderData}> => {
    return request.get('/api/chart/performanceData');
}
